import proto from '../proto/ProtoMsgV1_pb.js';
import ProtobufEncoder from '../code/ProtobufEncoder.js';

const HeartBeatMsgBuilder = {
	build: function(appId, userId, token, sessionId) {		
		// 原消息
		let protoObj = new proto.Message();
		protoObj.setType(proto.HeadType.HEART_BEAT);
		protoObj.setSequence(1);
		protoObj.setSessionId(sessionId);
		protoObj.setAppId(appId)
		
		let heartBeat = new proto.MessageHeartBeat();
		heartBeat.setSeq(1);
		heartBeat.setUid(userId);
		heartBeat.setExtra(token);

		protoObj.setHeartbeat(heartBeat);
		
		const encode = ProtobufEncoder.encode(protoObj);
		
		return encode;
	}
}

export default HeartBeatMsgBuilder;